import sys
import os
from PySide6.QtWidgets import *
from PySide6.QtGui import *
from PySide6.QtCore import *

class Demo(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.parent = parent
        layout = QVBoxLayout()
        toolBar=QToolBar()
        toolBar.addWidget(QLabel('Orientation:'))
        cb=QComboBox()
        cb.addItems(Qt.Orientation.__members__.keys())
        cb.currentTextChanged.connect(self.OnOrientationChanged)
        toolBar.addWidget(cb)

        layout.addWidget(toolBar)

        self.scrollBar=QScrollBar()
        self.scrollBar.valueChanged.connect(self.OnValueChanged)
        layout.addWidget(self.scrollBar)

        self.setLayout(layout)
    def OnOrientationChanged(self,text):        
        orientation=Qt.Orientation[text]
        self.scrollBar.setOrientation(orientation)        
        self.parent.OnShowMessage(f"Set Orientation:{orientation}")
    def OnValueChanged(self,value):
        self.parent.OnShowMessage(f"Current Value:{value}")

def runDemo(parent):
    wigdet =  Demo(parent)
    return wigdet